#include"graphics.h"
char str1[200];
char *str2="计算机应答区:";
void initial()
{
  initscr();
  cbreak;
  nonl();
  noecho();
  intrflush(stdscr,FALSE);
  keypad(stdscr,TRUE);
  refresh();
}
void talker()
{
     int flag=0;
     int count=0;
     
     WINDOW* win[2],*curwin,*helpwin;
     int nowwin;
int x,y;
int i;
int ch;
initial();
win[0]=newwin(6,20,17,75);

win[1]=newwin(6,20,24,75);
  

char p[]="对话功能:";
mvaddstr(16,75,p);


nowwin=0;
curwin=win[nowwin];
getyx(curwin,y,x);
move(0,0);
refresh();

refresh();

do
{
   wrefresh(curwin);
      
   nowwin=1-nowwin;
   curwin=win[nowwin];
   wclear(curwin);

   mvwaddstr(curwin,0,0,str2);
   wrefresh(curwin);


   if(count==0)
    {
     nowwin=1-nowwin;
     curwin=win[nowwin];
     wclear(curwin);
     wrefresh(curwin);
     echo();
     wgetstr(curwin,str1);
     noecho();
     if(str1!=NULL)
     talker_sql(str1);

    }
  

  if(count>0)
  {
   ch=readkey();
   switch(ch)
   {
    case 27:
      wclear(win[0]);
      wclear(win[1]);
      wrefresh(win[0]);
      wrefresh(win[1]);
      delwin(win[0]);
      delwin(win[1]);
      return ;

   default:
     nowwin=1-nowwin;
     curwin=win[nowwin];
     wclear(curwin);
     wrefresh(curwin);
     echo();
     wgetstr(curwin,str1);
     noecho();
     if(str1!=NULL)
     talker_sql(str1);

     break; 
  }
 }
wrefresh(curwin);  
count++;

}while(1);
}
